/*
 * CSessionTaskLock.cpp
 *
 *  Created on: 2012-11-8
 *      Author: dvr
 */


#include "CSessionManager.h"

int CSessionManager::GetPalyBackId()
{
	_nodemutex.ThreadLock();
	int 	i				= 1;//�±�0Ϊ���ػط�
	for(;i < MAX_GROUPID;i++)
	{
		if(!m_remoteplayback[i])
		{
			m_remoteplayback[i]	= 1;
		//	DEBUG_WARNING("---find-----i:[%d]------------\n",i);
			_nodemutex.ThreadUnlock();
			return	i;
		}
		//DEBUG_WARNING("-------continue----i:[%d]-----------\n",i);
	}
	_nodemutex.ThreadUnlock();
	return -1;
}

void CSessionManager::FreePalyBackId(int	index)
{
	_nodemutex.ThreadLock();
	m_remoteplayback[index]			= 0;
	_nodemutex.ThreadUnlock();
}

unsigned int	 CSessionManager::GetTaskIndex()
{
	return _taskIndex++;
}

